package com.lss.studydemo;

import android.util.Log;

public class FanController implements TemperatureListener{
    private boolean fanRunning = false;

    @Override
    public void onTemperatureExceeded(TemperatureEvent event) {
        if (!fanRunning) {
            fanRunning = true;
            Log.i("lss", "温度过高！开启风扇降温...");
            // 实际应用中这里控制物理风扇开启
        }
    }

    @Override
    public void onTemperatureReached(TemperatureEvent event) {
        if (fanRunning) {
            fanRunning = false;
            Log.i("lss", "温度恢复正常！关闭风扇");
            // 实际应用中这里控制物理风扇关闭
        }
    }
}
